/*
 * $Id: IClient.java 23 2002-09-29 13:59:30Z bpruessmann $
 * 
 * Copyright (c) 2001 Boris Pruessmann and others.
 * All rights reserved.   This program and the accompanying materials
 * are made available under the terms of the Common Public License v0.5
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/cpl-v05.html
 * 
 * Contributors:
 *    Boris Pruessmann - Initial implementation.
 *    David Corbin  - added revert, delete
 */
package net.sourceforge.p4eclipse.core.api;

import net.sourceforge.p4eclipse.core.PerforceException;
import net.sourceforge.p4eclipse.core.resources.RemoteFile;
import net.sourceforge.p4eclipse.core.syncinfo.FolderSyncInfo;
import net.sourceforge.p4eclipse.core.syncinfo.ResourceSyncInfo;
import org.eclipse.core.runtime.IProgressMonitor;

/**
  * @version	$Revision: 23 $
  * @author		<a href="mailto:bpruessmann@users.sourceforge.net">Boris Pruessmann</a>
  * @author		<a href="mailto:dcorbin@users.sourceforge.net">David Corbin</a>
  */
public interface IClient
{
	// low-level api functions	
	public void init();		
	public int dispose();
	public boolean dropped();

	public void setProtocol(String key, String value);	
		
	public void setPerforcePort(String serverNameAndPort);
	public String getPerforcePort();


	public void setPerforceClient(String client);	
	public String getPerforceClient();
	
	
	public void setPerforceUser(String user);	
	public String getPerforceUser();
	
	public void setArguments(String[] arguments);
	
	/**
	  * @deprecated Use run(IPerforceCommand) instead.
	  */
	public void run(String function, IClientUser clientUser);	

	public PerforceError getPerforceError();

	// high-level API functions

	/**
	  * Runs the specified IPerforceCommand.
	  */
	public void run(String[] arguments, IPerforceCommand command);
	
	/** 
	  * Create a changelist description.
	  */
	public void change(String changeSpec)
		throws PerforceException;

	/**
	  * Reads a changelist specification.
	  */		
	public IChangeResult change(Integer changelist)
		throws PerforceException;
		
	/**
	  * Display list of pending and submitted changelists.
	  */
	public IChangesResult[] changes(String status, int count)
		throws PerforceException;	

	/**
	  * Display list of known counters.
	  */
	public ICountersResult counters()
		throws PerforceException;

	/**
	  * Display a changelist description.
	  */
	public IDescribeResult describe(Integer changelist)
		throws PerforceException;

	/**
	  * List subdirectories of a given depot directory.
	  */
	public FolderSyncInfo[] dirs(String dir)
		throws PerforceException;

	public ILogEntry[] filelog(RemoteFile remoteFile, int maxRevs, boolean follow)
		throws PerforceException;

	/**
	  * Dump file info.
	  */
	public ResourceSyncInfo[] fstat(String file)
		throws PerforceException;

	/**
	  * Print out client/server information.
	  */
	public IInfoResult info();
	
	/**
	  * Display list of files opened for pending changelist.
	  */
	public IOpenedResult[] opened(Integer changelist)
		throws PerforceException;

	/**
	  * Display list of files opened for pending changelist.
	  */
	public IOpenedResult[] opened(boolean allClients)
		throws PerforceException;
	
	public void reopen(Integer changelist, String[] filenames)
		throws PerforceException;

	public IResolveResult[] resolve(String spec, boolean simulate)
		throws PerforceException;

	public String resolved(String filename)
		throws PerforceException;

	public String[] submit(String changeSpec)
		throws PerforceException;

	public void revert(String[] fileNames)
		throws PerforceException;

	public void delete(String[] fileNames)
		throws PerforceException;

	public void add(String[] fileNames)
		throws PerforceException;

	public void integrate(String from, String to)
		throws PerforceException;
	
	public void edit (String[] fileNames)
		throws PerforceException;

	public void sync(String syncSpecification)
		throws PerforceException;
		
	public String[] diff(String[] files)
		throws PerforceException;
		
	/**
	  * Show how file names map through the client view.
	  * @param filename in any supported Perforce format (depot, client, local)
	  */
	public IWhereResult where(String filename)
		throws PerforceException;

	public IWhereResult[] where(String[] filenames)
		throws PerforceException;
}

